{layout name="../common/master"/}
<div id="right">
       <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">所有指引列表
           <div class="btn-group">
               <a href="{:URL('home/Appconfig/addtechguide')}" class="btn btn-primary">添加</a>
           </div></h4>
    <!--<form action="" method="post" role="form">-->
        <!--<div class="form-group">-->
            <!--<input type="text" style="width: 200px;float: left;margin-right: 20px" class="form-control" value="{if condition='isset($uname)'}{$uname}{/if}" name="uname" id="" placeholder="上传名">-->
        <!--</div>-->
        <!--<button type="submit" class="btn btn-primary">查询</button>-->
        <!--<a href="{:URL('home/Docmanager/docupload')}" class="btn btn-success">上传文件</a>-->
    <!--</form>-->
    <table class="table-bordered table  table-hover" style="margin-top: 20px;">
        <thead>
        <tr>
            <th>ID</th>
            <th>pageDef</th>
            <th>firstSecreenPic</th>
            <th>youtubeID</th>
            <th>是否可用</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name="data" item="vo" key="k"}
            <tr>
                <th>{$vo['id']}</th>
                <th>{$vo['pageDef']}</th>
                <th>{$vo['firstSecreenPic']}</th>
                <th>{$vo['youtubeID']}</th>
                <th>{$vo['is_valid']}</th>
                <th>
                    <div class="btn-group">
                        <div class="btn-group">
                            {if condition="$vo['is_valid'] eq 0"}
                            <button type="button" uid="{$vo['id']}" class="valid btn btn-success">有效</button>
                            {elseif condition="$vo['is_valid'] eq 1"/}
                            <button type="button" uid="{$vo['id']}"  class="invalid btn btn-danger">无效</button>
                            {/if}
                        </div>
                    </div>
                </th>
            </tr>
        {/foreach}
        </tbody>
    </table>
</div>
<script>
    $(".valid").click(function () {
        var id=$(this).attr('uid');
         var status=1;
        $.post("{:URL('home/Appconfig/edittechguidestatus')}",{uid:id,status:status}, function (res) {
           if(res.code == 0){
              layer.alert('success');
               location.reload();
           }else{
               layer.alert(res.data);
           }
        })
    })
    $(".invalid").click(function () {
        var id=$(this).attr('uid');
        var status=0;
        $.post("{:URL('home/Appconfig/edittechguidestatus')}",{uid:id,status:status}, function (res) {
            if(res.code == 0){
                layer.alert('success');
                location.reload();
            }else{
                layer.alert(res.data);
            }
        })
    })
</script>